3 cups heavy cream
2 garlic cloves peeled
1 sprig thyme plus 3 tsp. fresh thyme leaves divided
2 tablespoons (1/4 stick) unsalted butter divided
3 leeks white and pale-green parts only, halved lengthwise, thinly sliced crosswise
Kosher Salt
2 lbs. russet potatoes peeled, very thinly sliced crosswise (1/8' thick)
1 lb. celery root peeled, very thinly sliced crosswise (1/8' thick)
2 cups grated Gruyère
Freshly ground black pepper
DO AHEAD: Can be made 2 hours ahead. Let stand at room temperature. Tent with foil and rewarm in a 300° oven until hot, about 20 minutes
Preheat to 350°. Heat cream, garlic, and thyme sprig in a medium saucepan just until bubbles begin to form around edge of pan.
Remove from heat; set aside to steep.
Melt 1 Tbsp. butter in a medium skillet over medium heat.
Add leeks; season with salt and cook, stirring often, until tender (do not brown), 10–12 minutes.
Transfer to a small bowl and set aside.
Butter a 3-qt. gratin dish with remaining 1 Tbsp butter.
Layer 1/3 of potato slices and 1/3 of celery root slices evenly over bottom of baking dish.
Cover with 1/3 of leeks, then 1/3 of Gruyère.
Sprinkle with salt, pepper, and 1 tsp. thyme leaves.
Repeat layers twice more.
Strain cream mixture into a medium pitcher and pour over vegetables.
Set gratin dish on a large rimmed baking sheet and cover tightly with foil.
Bake for 1 hour.
Carefully remove foil; continue baking until top is golden brown and sauce is bubbling, 25–30 minutes.